<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>历史查询</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
            background-color: #eeeeee;
            font-family: "楷体";
        }

        .item {
            margin: 20px 20px 50px;
        }

        .imte_top {
            text-align: center;
        }

        .imte_top > span {
            font-size: 14px;
            display: inline-block;
            padding: 5px 12px;
            background-color: #ddd;
            color: #fff;
            border-radius: 5px;
        }

        .item_content {
            background-color: #fff;
            padding: 25px 15px;
            margin-top: 6px;
        }

        .item_content_top_1 {
            font-size: 24px;
            font-weight: bold;
        }

        .item_content_top_2 {
            color: #bbb;
            font-size: 14px;
            margin: 5px 0;
        }

        .item_content_top_3 {
            margin: 10px 0;
        }

        .item_content_top_4 {
            margin: 10px 0;
        }

        .item_content_bottom > a {
            text-decoration: none;
            color: #33e;
        }

        .notice {
            color: #999;
            font-size: 14px;
            margin: 10px auto;
            display: block;
            width: max-content;
        }
    </style>
</head>
<body>
<div class="content"></div>
<script src="js/jquery.min.js"></script>
<script>
    $(function () {
        $.getJSON("/courier/getHistory.do", null, function (data) {
            var $content = $(".content");
            if (data.status === 0) {
                for (let i = 0; i < data.data.length; i++) {
                    let item = '<div class="item"><div class="imte_top"><span>' + data.data[i].intime + '</span></div><div class="item_content"><div class="item_content_top"><div class="item_content_top_1">派件历史</div><div class="item_content_top_2"><hr></div><div class="item_content_top_3">运单号码：' + data.data[i].number + '<br>' + ((data.data[i].outtime === "未出库") ? ('入库时间：' + data.data[i].intime) : ('出库时间：' + data.data[i].outtime)) + '</div><div class="item_content_top_4">快递公司：' + data.data[i].company + '<br>收件人电话：' + data.data[i].userphone + '<br>取件地址：学校快件集散中心<br>当前状态：<span style="color: ' + (data.data[i].status === "已取件" ? 'green' : 'orange') + '">' + data.data[i].status + '</span></div></div><div class="item_content_bottom"></div></div></div>'
                    $content.append(item);
                }
            } else if (data.status === -1) {
                $content.append('<span class="notice">这里什么都没有呢...快去录入快递吧<span>');
            } else if (data.status === -2) {
                $content.append('<span class="notice">必须绑定手机号才能查到快递信息<span>');
            } else if (data.status === -3) {
                location.assign('/index.html');
            }
        });
    });
</script>
</body>
</html>